﻿<controls:ChildWindow
    x:Class="GuidGeneratorSilverlight.GuidCountWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
    xmlns:local="clr-namespace:GuidGeneratorSilverlight"
    Title="GUID Generator" Loaded="ChildWindow_Loaded" KeyDown="ChildWindow_KeyDown">
    <controls:ChildWindow.Resources>
        <Style TargetType="Button">
            <Setter Property="MinWidth" Value="75" />
            <Setter Property="MinHeight" Value="27" />
            <Setter Property="Margin" Value="4" />
        </Style>
        <Style TargetType="TextBox">
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="Margin" Value="4" />
        </Style>
        <Style TargetType="TextBlock">
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="Margin" Value="4" />
        </Style>
        <local:InverseBooleanConverter x:Key="inverseBooleanConverter" />
    </controls:ChildWindow.Resources>
    
    <Grid x:Name="LayoutRoot" Margin="2">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>

        <TextBlock Grid.Row="0" Grid.Column="0">Generate</TextBlock>
        <TextBox Grid.Row="0" Grid.Column="1" Name="textBoxCount" MinWidth="50" Text="{Binding Count, NotifyOnValidationError=True, ValidatesOnExceptions=True, Mode=TwoWay}" TextChanged="textBoxCount_TextChanged" />
        <TextBlock Grid.Row="0" Grid.Column="2">GUIDs</TextBlock>
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3">
            <Button x:Name="OKButton" Content="OK" Click="OKButton_Click" MinWidth="75" MinHeight="23" HorizontalAlignment="Right" IsEnabled="{Binding ElementName=textBoxCount, Path=(Validation.HasError), Converter={StaticResource inverseBooleanConverter}}" />
            <Button x:Name="CancelButton" Content="Cancel" Click="CancelButton_Click" MinWidth="75" MinHeight="23" HorizontalAlignment="Right" />
        </StackPanel>
    </Grid>
</controls:ChildWindow>